#include "stdafx.h"
#include "RasterizerState.h"

namespace Reign
{namespace Video
{namespace D3D10
{
	#pragma region Properties
	D3D10_RASTERIZER_DESC* RasterizerStateDesc::Desc::get() {return desc;}
	#pragma endregion

	#pragma region Constructors
	RasterizerStateDesc::RasterizerStateDesc(RasterizerStateTypes type)
	{
		null();
		desc = new D3D10_RASTERIZER_DESC();
		switch (type)
		{
			case (RasterizerStateTypes::Solid_CullNone):
				desc->FillMode = D3D10_FILL_SOLID;
				desc->CullMode = D3D10_CULL_NONE;
				desc->FrontCounterClockwise = false;
				desc->DepthBias = 0;
				desc->DepthBiasClamp = 0.0f;
				desc->SlopeScaledDepthBias = 0.0f;
				desc->DepthClipEnable = true;
				desc->ScissorEnable = false;
				desc->MultisampleEnable = false;
				desc->AntialiasedLineEnable = false;
				break;

			case (RasterizerStateTypes::Solid_CullCW):
				desc->FillMode = D3D10_FILL_SOLID;
				desc->CullMode = D3D10_CULL_FRONT;
				desc->FrontCounterClockwise = false;
				desc->DepthBias = 0;
				desc->DepthBiasClamp = 0.0f;
				desc->SlopeScaledDepthBias = 0.0f;
				desc->DepthClipEnable = true;
				desc->ScissorEnable = false;
				desc->MultisampleEnable = false;
				desc->AntialiasedLineEnable = false;
				break;

			case (RasterizerStateTypes::Solid_CullCCW):
				desc->FillMode = D3D10_FILL_SOLID;
				desc->CullMode = D3D10_CULL_BACK;
				desc->FrontCounterClockwise = false;
				desc->DepthBias = 0;
				desc->DepthBiasClamp = 0.0f;
				desc->SlopeScaledDepthBias = 0.0f;
				desc->DepthClipEnable = true;
				desc->ScissorEnable = false;
				desc->MultisampleEnable = false;
				desc->AntialiasedLineEnable = false;
				break;

			default:
				Debug::ThrowError(L"RasterizerStateDesc", L"Unsuported RasterizerStateType");
				break;
		}
	}

	RasterizerStateDesc::~RasterizerStateDesc()
	{
		if (desc) delete desc;
		null();
	}

	void RasterizerStateDesc::null()
	{
		desc = 0;
	}
	#pragma endregion
}
}
}